# coding:utf-8
import re
from str2arry import str2arry
from checkSum import hex_checksum

key='123456'#'FEFEFEFEFE68AB5758ABCDEF9878F277889955810005920001AF16F616FF'

p1=r'\w\w16FF'
p2=r'FE68\w*16FF'
pattern1=re.compile(p1)
pattern2=re.compile(p2)
if re.search(pattern1,key) !=None:
    checkSum= re.search(pattern1,key).group()[:2]
    data=str2arry(re.search(pattern2,key).group()[2:-6])
    print checkSum,hex_checksum(data)
    print type(checkSum)
    if checkSum.split()==hex_checksum(data):
        print "校验正确"
        print checkSum.split(),data